package cn.lanqiao.ui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import cn.lanqiao.entity.CommonHero;
import cn.lanqiao.entity.User;
import cn.lanqiao.service.CommonService;
import cn.lanqiao.serviceimpl.CommonHeroServiceImpl;

import java.awt.Window.Type;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JLabel;
import java.awt.Font;
import java.awt.HeadlessException;

import javax.swing.JTextField;

public class CommonHeroFrm extends JFrame {
	CommonService commonHero = new CommonHeroServiceImpl(); //创建业务层对象
	private JPanel contentPane;
	private JTextField commonHeroName01;
	private JTextField commonHeroNum01;
	private JTextField commonHeroName02;
	private JTextField commonHeroNum02;
	private JTextField commonHeroName03;
	private JTextField commonHeroNum03;
	private User user;
	List list = commonHero.getList(user);
	CommonHero commonHero01 = (CommonHero) list.get(0);
	CommonHero commonHero02 = (CommonHero) list.get(1);
	CommonHero commonHero03 = (CommonHero) list.get(2);
	/**
	 * Create the frame.
	 */
	public CommonHeroFrm(User user) {
		this.user = user;
		setType(Type.UTILITY);
		setTitle("常用英雄");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 704, 588);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel label = new JLabel("英雄名字");
		label.setBounds(14, 82, 71, 53);
		label.setFont(new Font("宋体", Font.BOLD | Font.ITALIC, 15));
		contentPane.add(label);
		
		JLabel label_1 = new JLabel("使用场次");
		label_1.setBounds(14, 117, 71, 53);
		label_1.setFont(new Font("宋体", Font.BOLD | Font.ITALIC, 15));
		contentPane.add(label_1);
		
		commonHeroName01 = new JTextField();
		commonHeroName01.setBounds(98, 96, 86, 24);
		contentPane.add(commonHeroName01);
		commonHeroName01.setColumns(10);
		commonHeroName01.setText(commonHero01.getHeroName());
		
		commonHeroNum01 = new JTextField();
		commonHeroNum01.setBounds(98, 131, 86, 24);
		contentPane.add(commonHeroNum01);
		commonHeroNum01.setColumns(10);
		commonHeroNum01.setText(commonHero01.getUseNum());
		
		JLabel label_2 = new JLabel("英雄名字");
		label_2.setFont(new Font("宋体", Font.BOLD | Font.ITALIC, 15));
		label_2.setBounds(227, 82, 71, 53);
		contentPane.add(label_2);
		
		JLabel label_3 = new JLabel("使用场次");
		label_3.setFont(new Font("宋体", Font.BOLD | Font.ITALIC, 15));
		label_3.setBounds(227, 117, 71, 53);
		contentPane.add(label_3);
		
		commonHeroName02 = new JTextField();
		commonHeroName02.setBounds(312, 96, 86, 24);
		contentPane.add(commonHeroName02);
		commonHeroName02.setColumns(10);
		commonHeroName02.setText(commonHero02.getHeroName());
		
		commonHeroNum02 = new JTextField();
		commonHeroNum02.setBounds(312, 133, 86, 24);
		contentPane.add(commonHeroNum02);
		commonHeroNum02.setColumns(10);
		commonHeroNum02.setText(commonHero02.getUseNum());
		
		JLabel label_4 = new JLabel("英雄名字");
		label_4.setFont(new Font("宋体", Font.BOLD | Font.ITALIC, 15));
		label_4.setBounds(447, 82, 71, 53);
		contentPane.add(label_4);
		
		JLabel label_5 = new JLabel("使用场次");
		label_5.setFont(new Font("宋体", Font.BOLD | Font.ITALIC, 15));
		label_5.setBounds(447, 117, 71, 53);
		contentPane.add(label_5);
		
		commonHeroName03 = new JTextField();
		commonHeroName03.setBounds(532, 96, 86, 24);
		contentPane.add(commonHeroName03);
		commonHeroName03.setColumns(10);
		commonHeroName03.setText(commonHero03.getHeroName());
		
		commonHeroNum03 = new JTextField();
		commonHeroNum03.setBounds(532, 131, 86, 24);
		contentPane.add(commonHeroNum03);
		commonHeroNum03.setColumns(10);
		commonHeroNum03.setText(commonHero03.getUseNum());
	}
	public CommonHeroFrm(){
		super();
	}
	public String getID() {
		String id=user.getUserID();
		return id;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
}
	